package com.zmn.oms.common.constant;

import com.google.common.collect.Lists;
import com.zmn.common.dictionary.DictModel;

import java.util.List;

/**
 * 派单方式枚举
 *
 * @author Yangk
 * @since 2021年2月22日
 */
public enum ConfDistributeWayEnum {

    /**
     * values
     */
    DISTRIBUTE_WAY_PLAT(10, "平台直派"),
    DISTRIBUTE_WAY_SP(20, "服务商派单");

    /**
     * 合作类型 0 全部
     */
    public final static int PROXY_TYPE_ALL = 0;
    public final static String PROXY_TYPE_ALL_STR = "全部";

    /**
     * 合作类型 1 直营
     */
    public final static int PROXY_TYPE_DIRECT = 1;
    public final static String PROXY_TYPE_DIRECT_STR = "直营工程师";

    /**
     * 合作类型 2 非直营
     */
    public final static int PROXY_TYPE_JOIN = 2;
    public final static String PROXY_TYPE_JOIN_STR = "非直营工程师";

    private Integer code;
    private String describe;

    ConfDistributeWayEnum(Integer code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescribe() {
        return describe;
    }

    public static ConfDistributeWayEnum of(Integer code) {
        if (code == null || code == 0) {
            return null;
        }
        switch (code) {
            case 10:
                return DISTRIBUTE_WAY_PLAT;
            case 20:
                return DISTRIBUTE_WAY_SP;
            default:
                return null;
        }
    }

    public static List<DictModel> getEngineerList() {
        List<DictModel> items = Lists.newArrayList();
        items.add(new DictModel(ConfDistributeWayEnum.PROXY_TYPE_ALL,ConfDistributeWayEnum.PROXY_TYPE_ALL_STR));
        items.add(new DictModel(ConfDistributeWayEnum.PROXY_TYPE_DIRECT, ConfDistributeWayEnum.PROXY_TYPE_DIRECT_STR));
        items.add(new DictModel(ConfDistributeWayEnum.PROXY_TYPE_JOIN, ConfDistributeWayEnum.PROXY_TYPE_JOIN_STR));
        return items;
    }

}
